package com.openness.example.crawler;

import java.io.IOException;
import java.util.Map;

import org.apache.hadoop.hbase.util.Bytes;

import com.openness.crawler.crawler.CrawlConfig;
import com.openness.crawler.hbase.HBaseTablePool;
import com.openness.crawler.hbase.HBaseUtil;

/**
 * @author Rain
 * @version 2013-6-3 下午3:17:55
 */

public class CountersMain {

	public static void main(String[] args) throws IOException, Throwable {
		CrawlConfig config = new CrawlConfig();

		config.setHbaseMaster("leaderman.rain.centos:60010");
		config.setHbaseZooKeeperQuorum("leaderman.rain.centos");
		config.setHbaseZooKeeperPropertyClientPort("2181");
		config.setHbaseTablePoolSize(1);

		HBaseTablePool.initialize(config);

		Map<String, byte[]> result = HBaseUtil.getRow("crawler_counters",
				Bytes.toBytes("counters"));

		System.out.println("processedpages: "
				+ Bytes.toLong(result.get("processedpages")));
		System.out.println("scheduledpages: "
				+ Bytes.toLong(result.get("scheduledpages")));

		HBaseTablePool.shutdown();

	}

}
